package run.halo.app.utils.flexmark.ext.pandoc.math.internal;

import com.vladsch.flexmark.util.options.DataHolder;
import com.vladsch.flexmark.util.options.MutableDataHolder;
import com.vladsch.flexmark.util.options.MutableDataSetter;
import run.halo.app.utils.flexmark.ext.pandoc.math.MathExtension;

public class MathOptions implements MutableDataSetter {
    public final String inlineMathClass;
    public final String blockMathClass;
    public final boolean nestedBlockMath;

    public MathOptions(DataHolder options) {
        this.inlineMathClass = MathExtension.INLINE_MATH_CLASS.getFrom(options);
        this.blockMathClass = MathExtension.BLOCK_MATH_CLASS.getFrom(options);
        this.nestedBlockMath = MathExtension.NESTED_BLOCK_MATH.getFrom(options);
    }

    @Override
    public MutableDataHolder setIn(MutableDataHolder mutableDataHolder) {
        mutableDataHolder.set(MathExtension.INLINE_MATH_CLASS, inlineMathClass);
        mutableDataHolder.set(MathExtension.BLOCK_MATH_CLASS, blockMathClass);
        mutableDataHolder.set(MathExtension.NESTED_BLOCK_MATH, nestedBlockMath);

        return mutableDataHolder;
    }
}
